﻿using System;
namespace Producers.Rr.Xtee.Riik.Ee.Producer.Rr {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="RR92Response", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RR92Response))]
    public class RR92ResponseSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IRR92Response clazz;
        
        public RR92ResponseSerializer(IRR92Response clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("AVVeaTekst");
            if (clazz.AVVeaTekst!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.AVVeaTekst))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : AVVeaTekst");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("IsikuEnimi");
            if (clazz.IsikuEnimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuEnimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IsikuEnimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("IsikuPnim");
            if (clazz.IsikuPnim!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuPnim))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IsikuPnim");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Isikukood");
            if (clazz.Isikukood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Isikukood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikukood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Synniaeg");
            if (clazz.Synniaeg!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Synniaeg))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Synniaeg");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Synnikoht");
            if (clazz.Synnikoht!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Synnikoht))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Synnikoht");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Sugu");
            if (clazz.Sugu!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Sugu))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Sugu");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Elukoht");
            if (clazz.Elukoht!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Elukoht))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Elukoht");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Kodakondsus");
            if (clazz.Kodakondsus!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kodakondsus))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Kodakondsus");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Rahvus");
            if (clazz.Rahvus!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Rahvus))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Rahvus");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("HaridusTase");
            if (clazz.HaridusTase!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.HaridusTase))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : HaridusTase");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Emakeel");
            if (clazz.Emakeel!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Emakeel))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Emakeel");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Perekonnaseis");
            if (clazz.Perekonnaseis!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Perekonnaseis))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Perekonnaseis");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Tegevusala");
            if (clazz.Tegevusala!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Tegevusala))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Tegevusala");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("MuudPerenimed");
            if (clazz.MuudPerenimed!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MuudPerenimed))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : MuudPerenimed");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("MuusEesnimed");
            if (clazz.MuusEesnimed!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MuusEesnimed))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : MuusEesnimed");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Isanimi");
            if (clazz.Isanimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Isanimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isanimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Kontaktandmed");
            if (clazz.Kontaktandmed!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kontaktandmed))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Kontaktandmed");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Sideaadress");
            if (clazz.Sideaadress!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Sideaadress))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Sideaadress");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Veakood");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "int");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdInt(((int)(clazz.Veakood))).ToString());
            Writer.WriteEndElement();
            Writer.WriteStartElement("Veatekst");
            if (clazz.Veatekst!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Veatekst))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Veatekst");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Dokumendiandmed");
            if (clazz.Dokumendiandmed!=null) {
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute(">>>RR92Response>Dokumendiandmed>Dokumendiandmed", "http://producers.rr.xtee.riik.ee/producer/rr", clazz.Dokumendiandmed.Count);
                for (int x = 0; ((clazz.Dokumendiandmed != null) 
                            && (x < clazz.Dokumendiandmed.Count)); x = (x + 1)) {
                    if (clazz.Dokumendiandmed[x]!=null) {
                        Writer.WriteStartElement("Dokumendiandmed");
                        global::Xtee.Core.SerializationMetadata metaDokumendiandmed = this.GetMetaData(clazz.Dokumendiandmed[x]);
                        Writer.WriteTypeAttribute(metaDokumendiandmed.TypeQualifiedName.Namespace, metaDokumendiandmed.TypeQualifiedName.Name);
                        metaDokumendiandmed.NewSerializer(clazz.Dokumendiandmed[x]).WriteXml(Writer);
                        Writer.WriteEndElement();
                    }
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Dokumendiandmed");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Paringud");
            if (clazz.Paringud!=null) {
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute(">>>RR92Response>Paringud>Paring", "http://producers.rr.xtee.riik.ee/producer/rr", clazz.Paringud.Count);
                for (int x = 0; ((clazz.Paringud != null) 
                            && (x < clazz.Paringud.Count)); x = (x + 1)) {
                    if (clazz.Paringud[x]!=null) {
                        Writer.WriteStartElement("Paring");
                        global::Xtee.Core.SerializationMetadata metaParingud = this.GetMetaData(clazz.Paringud[x]);
                        Writer.WriteTypeAttribute(metaParingud.TypeQualifiedName.Namespace, metaParingud.TypeQualifiedName.Name);
                        metaParingud.NewSerializer(clazz.Paringud[x]).WriteXml(Writer);
                        Writer.WriteEndElement();
                    }
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Paringud");
            }
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="AVVeaTekst") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>AVVeaTekst");
                }
                clazz.AVVeaTekst = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("AVVeaTekst")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>AVVeaTekst", Reader.LocalName);
            }
            if (Reader.LocalName=="IsikuEnimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>IsikuEnimi");
                }
                clazz.IsikuEnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("IsikuEnimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>IsikuEnimi", Reader.LocalName);
            }
            if (Reader.LocalName=="IsikuPnim") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>IsikuPnim");
                }
                clazz.IsikuPnim = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("IsikuPnim")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>IsikuPnim", Reader.LocalName);
            }
            if (Reader.LocalName=="Isikukood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>Isikukood");
                }
                clazz.Isikukood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Isikukood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>Isikukood", Reader.LocalName);
            }
            if (Reader.LocalName=="Synniaeg") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>Synniaeg");
                }
                clazz.Synniaeg = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Synniaeg")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>Synniaeg", Reader.LocalName);
            }
            if (Reader.LocalName=="Synnikoht") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>Synnikoht");
                }
                clazz.Synnikoht = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Synnikoht")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>Synnikoht", Reader.LocalName);
            }
            if (Reader.LocalName=="Sugu") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>Sugu");
                }
                clazz.Sugu = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Sugu")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>Sugu", Reader.LocalName);
            }
            if (Reader.LocalName=="Elukoht") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>Elukoht");
                }
                clazz.Elukoht = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Elukoht")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>Elukoht", Reader.LocalName);
            }
            if (Reader.LocalName=="Kodakondsus") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>Kodakondsus");
                }
                clazz.Kodakondsus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Kodakondsus")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>Kodakondsus", Reader.LocalName);
            }
            if (Reader.LocalName=="Rahvus") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>Rahvus");
                }
                clazz.Rahvus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Rahvus")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>Rahvus", Reader.LocalName);
            }
            if (Reader.LocalName=="HaridusTase") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>HaridusTase");
                }
                clazz.HaridusTase = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("HaridusTase")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>HaridusTase", Reader.LocalName);
            }
            if (Reader.LocalName=="Emakeel") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>Emakeel");
                }
                clazz.Emakeel = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Emakeel")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>Emakeel", Reader.LocalName);
            }
            if (Reader.LocalName=="Perekonnaseis") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>Perekonnaseis");
                }
                clazz.Perekonnaseis = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Perekonnaseis")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>Perekonnaseis", Reader.LocalName);
            }
            if (Reader.LocalName=="Tegevusala") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>Tegevusala");
                }
                clazz.Tegevusala = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Tegevusala")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>Tegevusala", Reader.LocalName);
            }
            if (Reader.LocalName=="MuudPerenimed") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>MuudPerenimed");
                }
                clazz.MuudPerenimed = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("MuudPerenimed")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>MuudPerenimed", Reader.LocalName);
            }
            if (Reader.LocalName=="MuusEesnimed") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>MuusEesnimed");
                }
                clazz.MuusEesnimed = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("MuusEesnimed")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>MuusEesnimed", Reader.LocalName);
            }
            if (Reader.LocalName=="Isanimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>Isanimi");
                }
                clazz.Isanimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Isanimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>Isanimi", Reader.LocalName);
            }
            if (Reader.LocalName=="Kontaktandmed") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>Kontaktandmed");
                }
                clazz.Kontaktandmed = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Kontaktandmed")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>Kontaktandmed", Reader.LocalName);
            }
            if (Reader.LocalName=="Sideaadress") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>Sideaadress");
                }
                clazz.Sideaadress = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Sideaadress")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>Sideaadress", Reader.LocalName);
            }
            if (Reader.LocalName=="Veakood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>Veakood");
                }
                clazz.Veakood = new global::Xtee.Core.Schema.XsdInt(Reader.ReadElementString("Veakood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>Veakood", Reader.LocalName);
            }
            if (Reader.LocalName=="Veatekst") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>Veatekst");
                }
                clazz.Veatekst = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Veatekst")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>Veatekst", Reader.LocalName);
            }
            if (Reader.LocalName=="Dokumendiandmed") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>Dokumendiandmed");
                }
                clazz.Dokumendiandmed = new System.Collections.Generic.List<RR92Response.IDokumendiandmedType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("Dokumendiandmed");
                    for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                && (Reader.LocalName == "Dokumendiandmed")); ) {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RR92Response>Dokumendiandmed>Dokumendiandmed");
                        }
                        global::Xtee.Core.SerializationMetadata metaDokumendiandmed = this.GetMetaData<RR92Response.IDokumendiandmedType>(Reader, ">>>RR92Response>Dokumendiandmed>Dokumendiandmed", "http://producers.rr.xtee.riik.ee/producer/rr");
                        RR92Response.IDokumendiandmedType item = metaDokumendiandmed.NewEntity<RR92Response.IDokumendiandmedType>();
                        clazz.Dokumendiandmed.Add(item);
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("Dokumendiandmed");
                            metaDokumendiandmed.NewSerializer(item).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>Dokumendiandmed", Reader.LocalName);
            }
            if (Reader.LocalName=="Paringud") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR92Response>Paringud");
                }
                clazz.Paringud = new System.Collections.Generic.List<RR92Response.IParingudType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("Paringud");
                    for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                && (Reader.LocalName == "Paring")); ) {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RR92Response>Paringud>Paring");
                        }
                        global::Xtee.Core.SerializationMetadata metaParingud = this.GetMetaData<RR92Response.IParingudType>(Reader, ">>>RR92Response>Paringud>Paring", "http://producers.rr.xtee.riik.ee/producer/rr");
                        RR92Response.IParingudType item = metaParingud.NewEntity<RR92Response.IParingudType>();
                        clazz.Paringud.Add(item);
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("Paring");
                            metaParingud.NewSerializer(item).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR92Response>Paringud", Reader.LocalName);
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>RR92Response>Dokumendiandmed>Dokumendiandmed", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RR92Response.DokumendiandmedType))]
        public class DokumendiandmedTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected RR92Response.IDokumendiandmedType clazz;
            
            public DokumendiandmedTypeSerializer(RR92Response.IDokumendiandmedType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("Dokumendiandmed.Kood");
                if (clazz.DokumendiandmedKood!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedKood))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedKood");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.Nimetus");
                if (clazz.DokumendiandmedNimetus!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedNimetus))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedNimetus");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.Seeria");
                if (clazz.DokumendiandmedSeeria!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedSeeria))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedSeeria");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.Number");
                if (clazz.DokumendiandmedNumber!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedNumber))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedNumber");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.DokValjastamisKuup");
                if (clazz.DokumendiandmedDokValjastamisKuup!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedDokValjastamisKuup))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedDokValjastamisKuup");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.VajandAsutus");
                if (clazz.DokumendiandmedVajandAsutus!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedVajandAsutus))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedVajandAsutus");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.KehtivAlates");
                if (clazz.DokumendiandmedKehtivAlates!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedKehtivAlates))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedKehtivAlates");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.KehtivKuni");
                if (clazz.DokumendiandmedKehtivKuni!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedKehtivKuni))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedKehtivKuni");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
                if (Reader.LocalName=="Dokumendiandmed.Kood") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR92Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Kood");
                    }
                    clazz.DokumendiandmedKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.Kood")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR92Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Kood", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.Nimetus") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR92Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Nimetus");
                    }
                    clazz.DokumendiandmedNimetus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.Nimetus")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR92Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Nimetus", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.Seeria") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR92Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Seeria");
                    }
                    clazz.DokumendiandmedSeeria = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.Seeria")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR92Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Seeria", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.Number") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR92Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Number");
                    }
                    clazz.DokumendiandmedNumber = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.Number")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR92Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Number", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.DokValjastamisKuup") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR92Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.DokValjastamisKu" +
                                "up");
                    }
                    clazz.DokumendiandmedDokValjastamisKuup = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.DokValjastamisKuup")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR92Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.DokValjastamisKu" +
                            "up", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.VajandAsutus") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR92Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.VajandAsutus");
                    }
                    clazz.DokumendiandmedVajandAsutus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.VajandAsutus")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR92Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.VajandAsutus", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.KehtivAlates") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR92Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.KehtivAlates");
                    }
                    clazz.DokumendiandmedKehtivAlates = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.KehtivAlates")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR92Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.KehtivAlates", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.KehtivKuni") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR92Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.KehtivKuni");
                    }
                    clazz.DokumendiandmedKehtivKuni = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.KehtivKuni")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR92Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.KehtivKuni", Reader.LocalName);
                }
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>RR92Response>Paringud>Paring", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RR92Response.ParingudType))]
        public class ParingudTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected RR92Response.IParingudType clazz;
            
            public ParingudTypeSerializer(RR92Response.IParingudType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("Kuupaev");
                if (clazz.Kuupaev!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kuupaev))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Kuupaev");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Parija");
                if (clazz.Parija!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Parija))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Parija");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
                if (Reader.LocalName=="Kuupaev") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR92Response>Paringud>Paring>Kuupaev");
                    }
                    clazz.Kuupaev = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Kuupaev")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR92Response>Paringud>Paring>Kuupaev", Reader.LocalName);
                }
                if (Reader.LocalName=="Parija") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR92Response>Paringud>Paring>Parija");
                    }
                    clazz.Parija = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Parija")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR92Response>Paringud>Paring>Parija", Reader.LocalName);
                }
            }
        }
    }
}
